DIALOGBOX 71, 20, 235, 107, 21, "Graphics - Menu Bar - Dialog Boxes"
LTEXT 7, 10, 219, 33, "This part of the TOUR will demonstrate several methods WinComm provides for data entry and option selection. Notice the Menu Bar has changed to allow different selections in this part of the Tour."
LTEXT 7, 42, 221, 33, "Select each menu item and explore the many capabilities of WinComm. When you are finished, select WinComm Menu to halt this macro and redisplay WinComms normal Menu Bar."
DEFCANCELBUTTON 90, 81, 50, 14, "&OK"
DEND
DO i = DIALOG? UNTIL(i != 255)
main_loop:
i = menu?
if(i==2) gosub win_return
else if(i==3) gosub flist_vtext
else if(i==4) gosub fil_sel
else if(i==5) gosub mail
else if(i==6) gosub next
else if(i==7) gosub maps
GOTO main_loop
;****** Dialog Boxes|FLIST & VTEXT *
flist_vtext:
DIALOGBOX 10, 14, 274, 162, 17
CTEXT 86, 6, 77, 9, "Dialog Box Example"
LTEXT 12, 15, 234, 19, "This dialog box is used to demonstrate the various types of controls that can be used within WinComm dialog boxes."
FLISTBOX 8, 63, 155, 33, LIST1$, VAR2$
LTEXT 12, 37, 151, 24, "This is a File Linked List box which displays a list of items contained in a text file."
LTEXT 11, 98, 153, 40, "When an Item is selected in the list box, the value of DIALOG? changes and the selected text is assigned to a variable. This Macro places that string in the Variable Text box below."
VTEXT 10, 143, 150, 9, VAR2$
LTEXT 170, 36, 89, 17, "The list displayed is contained in the file:"
VTEXT 180, 57, 63, 10, LIST1$
GROUPBOX 166, 30, 1, 126, ""
LTEXT 171, 70, 87, 31, "which the Macro can change by selecting the Update Pushbutton below."
GROUPBOX 7, 30, 261, 5, ""
UPDATEPB 177, 105, 78, 14, "&Update Pushbutton"
DEFPUSHBUTTON 177, 136, 78, 14, "&OK"
GROUPBOX 170, 123, 98, 5, ""
GROUPBOX 9, 136, 153, 18, ""
GROUPBOX 177, 49, 69, 20, ""
DEND
test: ;DIALOG? returns 255 while there is no activity in the
;dialog box. DIALOG? is reset each time it is tested
DO ;so its value must be assigned to a variable for processing
i = DIALOG? ;If a pushbutton is selected or something in a list box
UNTIL(i != 255) ;is selected, the value will change and the macro
;will fall through this loop
;code below tests for the selection of an UPDATEPUSHBUTTON
;DIALOG? returns 100 for the first UPDATEPUSHBUTTON
;101 for the second up to a maximum of 103 for the fourth
UPDATEDLG(17) ;Updates both the VETEXT and LIST BOX
GOTO test
}
;Tests for a selection in the List Box
;DIALOG? returns 200 for the first (F)LISTBOX
;101 for the second up to a maximum of 103 for the fourth
IF(i == 200){
UPDATEDLG(16) ;Updates only VETEXT
GOTO test
}
RETURN ;goes back to menu processing if neither the UPDATEPB or LISTBOX selected
;***** Dialog Boxes|File Selection **
fil_sel:
ftmp$ = "dlgdmo.fil"
b$ = "AGNY.DOC"
fdescr$ = "General Information - Directory of Oklahoma Agencies" ;causes this item to be
;selected in the list box
DIALOGBOX 57, 10, 199, 194, 17
CTEXT 45, 4, 108, 8, "Files Available on ORIGINS:"
CTEXT 96, 13, 71, 9, "File Description:"
VTEXT 77, 26, 115, 54, FDESCR$
UPDATEPB 29, 97, 62, 14, "&Receive File"
UPDATEPB 111, 97, 62, 14, "&Cancel"
FLISTBOX 8, 25, 64, 65, FTMP$, B$
LTEXT 5, 121, 190, 41, "This is an example of one use of the FLISTBOX and the code required to update the description when a file is selected. Select different files and notice the discription change. The pushbuttons above are not active."
DEFPUSHBUTTON 65, 169, 69, 14, "&OK"
CTEXT 20, 13, 41, 9, "File Name:"
GROUPBOX 7, 111, 186, 5, ""
GROUPBOX 75, 21, 120, 60, ""
DEND
testy:
DO i = DIALOG? UNTIL(i != 255) ;this line has 3 statements but works just like the three lines
;under the label "test"
IF(i == 100){ ;UPDATEPB pressed but don't do anything
UPDATEDLG(0) ;resets DIALOG?
GOTO testy
}
IF(i == 101){ ;the other UPDATEPB pressed but don't do anything
UPDATEDLG(0) ;resets DIALOG?
GOTO testy
}
IF(i == 200){ ;file selected in list box,
fdescr$ = EXTRACT(CHAR(9),b$,2) ;extract description and display it.
UPDATEDLG(16) ;Updates VETEXT
GOTO testy
}
return ;go back to menu processing
;**** Dialog Boxes|Mail **
mail:
date$ = left(strtime(time?),10)
time$ = mid(strtime(time?),12,8)
mail$ = "mail.txt"
TO$ = ""
SUBJ$ = ""
DIALOGBOX 53, 10, 230, 212, 17
LTEXT 103, 4, 18, 9, "Mail"
RTEXT 18, 18, 21, 9, "To:"
EDIT 40, 15, 175, 13, TO$
RTEXT 7, 33, 32, 9, "Subject:"
EDIT 40, 31, 175, 13, SUBJ$
RTEXT 19, 49, 20, 9, "Date:"
EDIT 40, 47, 75, 13, DATE$
RTEXT 119, 49, 20, 9, "Time:"
EDIT 140, 47, 75, 13, TIME$
SEDIT 8, 64, 216, 57, MAIL$
DEFPUSHBUTTON 36, 123, 71, 15, "&Save"
CANCELBUTTON 123, 123, 72, 15, "&Discard"
GROUPBOX 5, 138, 221, 5, ""
LTEXT 9, 143, 212, 35, "This dialog box shows two other types of controls. The framed rectangles are EDIT boxes and allow text entry and editing. The box with the vertical scroll bar is also an EDIT box but its contents are stored in a disk file which can be"
LTEXT 9, 175, 210, 35, "up to 16,000 characters in length. Create a mail message by filling in the blanks and check the SAVE button. After this dialog box disappears the Macro will display one of WinComms 'stock' dialog boxes for naming the mail file."
DEND
DO i = DIALOG? UNTIL(i != 255)
IF(i == 0){
DIALOGBOX 77, 21, 154, 87, 17
LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time? If you haven't saved one yet you won't be able to read it later in the demonstration."
DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail"
CANCELBUTTON 24, 62, 100, 14, "&Lets Go On"
DEND
DO j = DIALOG? UNTIL(j != 255)
IF(j == 0)RETURN ;go back to menu processing
ELSE GOTO mail
}
ELSE IF(i == 1){
mail_mess = FOPEN(4096,"~~temp.txt") ;create a temp file
mail = FOPEN(2,mail$) ;open the file created by the SEDIT box
FWRITELN(mail_mess,to$) ;add information to the temp file
FWRITELN(mail_mess,subj$)
FWRITELN(mail_mess,date$)
FWRITELN(mail_mess,time$)
DO
str$ = FREAD(mail,255) ;copy the mail file to the temp file for display
FWRITE(mail_mess,255,str$)
UNTIL(NULL(str$) == TRUE) ;everything copied
FCLOSE(mail_mess)
FCLOSE(mail)
DELETEFILE("mail.txt")
a$ = ".MLE"
IF(SAVEASDLG("Save Mail Message as what File Name",a$) == FALSE){
DIALOGBOX 77, 21, 154, 87, 17
LTEXT 7, 7, 140, 33, "You don't want to save a Mail message this time? If you haven't saved one yet you won't be able to read it later in the demonstration."
DEFPUSHBUTTON 24, 44, 99, 14, "&OK I Will Send Mail"
CANCELBUTTON 24, 62, 100, 14, "&Lets Go On"
DEND
DO j = DIALOG? UNTIL(j != 255)
IF(j == 0){
DELETEFILE("~~temp.txt")
RETURN
}
ELSE GOTO mail
}
ELSE RENAME("~~temp.txt",a$)
}
IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE)RETURN ;cancel selected go back to menu
GOSUB extractit
var11$ = "~~temp.txt"
DIALOGBOX 53, 10, 230, 202, 17
LTEXT 103, 4, 18, 9, "Mail"
RTEXT 18, 18, 21, 9, "To:"
VTEXT 43, 18, 175, 9, TO$
RTEXT 7, 33, 32, 9, "Subject:"
VTEXT 43, 33, 175, 9, SUBJ$
RTEXT 19, 49, 20, 9, "Date:"
VTEXT 42, 49, 72, 9, DATE$
RTEXT 119, 49, 20, 9, "Time:"
VTEXT 143, 49, 75, 9, TIME$
STEXT 10, 62, 215, 58, VAR11$
UPDATEPB 36, 123, 71, 15, "&Read Another"
CANCELBUTTON 123, 123, 72, 15, "&Finished"
GROUPBOX 5, 138, 221, 5, ""
LTEXT 9, 144, 212, 33, "This is an example of a dialog box for reading mail. The text box with the vertical scroll bar in this case is a STEXT box which is read only. The [Read Another] button is an UPDATEPB which displays a 'Stock Dialog Box' that allows"
LTEXT 9, 176, 210, 24, "selection of another Mail file. When the new mail file is selected, this dialog box is updated with the information in the selected file."
GROUPBOX 40, 12, 183, 16, ""
GROUPBOX 40, 27, 183, 16, ""
GROUPBOX 141, 43, 82, 16, ""
GROUPBOX 40, 43, 77, 16, ""
DEND
read_mail:
DO i = DIALOG? UNTIL(i != 255)
IF(i == 100){
DELETEFILE("~~temp.txt") ;make for shure we get rid of that temp file
IF(FILEOPENDLG("Select Mail File For Reading","*.mle",var2$) == FALSE){
GOTO read_mail
}
GOSUB extractit
GOTO read_mail
}
DELETEFILE("~~temp.txt") ;that temp file better be gone by now!!!
RETURN ;finished--back to menu processing
;***** Subroutine **
extractit: ;Subroutine to remove information fron the front of the mail file
;for display in the Read Mail Dialog box.
mail = FOPEN(2,var2$) ;open the file selected in the FILEOPENDLG dialog box
to$ = FREADLN(mail) ;extract information from the mail file and assign
subj$ = FREADLN(mail) ;to the proper variables
date$ = FREADLN(mail)
time$ = FREADLN(mail)
mail_mess = FOPEN(4096,"~~temp.txt")
DO
str$ = FREAD(mail,255) ;copy the rest of the mail file to a temprary file for display
FWRITE(mail_mess,255,str$)
UNTIL(NULL(str$) == TRUE)
FCLOSE(mail)
FCLOSE(mail_mess)
UPDATEDLG(18)
RETURN
;****** Dialog Boxes|Other Samples **
next:
var1$ = ""
spec$ = "spec.txt;20 30 40" ;assign the variable for the file to display in the FLIST box
IF(DG == 200){ ;something selected in list box but we don't do anything with it here
UPDATEDLG(0)
GOTO cont1
}
ELSE return ;finished with this, process those menus
;****** WinComm Menu **
win_return: ;somebody wants to go back to wincomms menu
SHOWBAR(m0)
i = GETSESSINT(68)
PUTSESSINT(68,0) ; disable auto sizing
OPEN("TOUR.WSF","",1)
PUTSESSINT(68,i) ; disable auto sizing
HALT
;******* Graphic Menu|Maps **
maps:
ENABLEMENU(m1,2,1) ;disable all menu items while running the hotspot program
ENABLEMENU(m1,3,1) ;the menus do not need to be disabled and could be fully
ENABLEMENU(m1,4,1) ;functional, as the macro could continue to process MENU?
ENABLEMENU(m1,5,1) ;but for a demo what do you want?
ENABLEMENU(m1,6,1)
ENABLEMENU(m1,7,1)
SHOWBAR(m1)
show(1)
i = GETSESSINT(68)
PUTSESSINT(68,0)
OPEN("GRAPHIC.WSF","",0)
PUTSESSINT(68,i)
DIALOGBOX 87, 27, 201, 106, 21, "Button and Graphics Demo"
LTEXT 16, 9, 169, 25, "This part of the Tour will allow you to make selections of Cities and States from a map."
LTEXT 17, 40, 165, 34, "Select a region, then select Cities and States by clicking on the names. Click on USA Map then Complete to finish this part of the demo."
DEFPUSHBUTTON 73, 79, 50, 14, "OK"
DEND
DO i = DIALOG? UNTIL(i != 255)
FCLOSE(FOPEN(4096,macro$+"\fill.txt")) ;create a file called fill.txt
Var1$ = macro$+"\fill.txt"
first = 1
vra2$ = ""
USA:
DELOBJECT(0,0,0)
USERWINDOW(5,0,100,16776960)
METABKG(0,0,1,"us_color.wmf")
BUTTON(-81,2459,1258,590,"1001,&WEST")
BUTTON(2016,2276,1259,590,"1002,MOU&NTAIN")
BUTTON(4208,3089,1259,570,"1003,&PLAINS")
BUTTON(3708,5366,1258,589,"1004,&TEXAS")
BUTTON(825,7439,1259,589,"1005,&ALASKA")
BUTTON(4357,8455,1259,590,"1006,&HAWAII")
BUTTON(6179,2707,1258,586,"1007,MID&WEST")
BUTTON(6101,4951,1257,586,"1008,SO&UTH")
BUTTON(8035,1488,1415,585,"1009,NO&RTHEAST")
BUTTON(7930,3496,1420,589,"1010,S&OUTHEAST")
SHOW(6)
if(first==1){
first = 0
GOTO us_test
}
;will come here if we have already been to the regions
Var2$ = ""
DIALOGBOX 60, 12, 207, 170, 17
LTEXT 55, 5, 108, 9, "States and Metros Selected"
FLISTBOX 8, 20, 90, 140, VAR1$, VAR2$
DEFPUSHBUTTON 130, 123, 47, 14, " &Complete "
PUSHBUTTON 130, 65, 47, 14, "&USA "
LTEXT 103, 33, 82, 9, "To return to USA map "
LTEXT 103, 42, 94, 9, "for additional regional "
LTEXT 103, 50, 76, 9, "selections..."
LTEXT 103, 97, 93, 9, "When no more selections "
LTEXT 103, 106, 58, 9, "are desired..."
DEND
cont_it:
DO dg = DIALOG? UNTIL(dg != 255)
if(dg==1) GOTO exit
if(dg==200){
UPDATEDLG(0)
GOTO cont_it
}
us_test:
i = object?
IF(i == 1001) goto nope ;this is where we test to see which hotspot has been selected
ELSE IF(i == 1002) goto Mountain ;just like processing menus
ELSE IF(i == 1003) goto Plains
ELSE IF(i == 1004) goto nope
ELSE IF(i == 1005) goto AK_HI
ELSE IF(i == 1006) goto AK_HI
ELSE IF(i == 1007) goto nope
ELSE IF(i == 1008) goto nope
ELSE IF(i == 1009) goto NE
ELSE IF(i == 1010) goto nope
goto us_test
;------------------------------------------------P L A I N S --------------------------------------